# -*- coding: utf-8 -*-
#   /**
#   * Copyright (c) 2022 Beijing Jiaotong University
#   * PhotLab is licensed under [Open Source License].
#   * You can use this software according to the terms and conditions of the [Open Source License].
#   * You may obtain a copy of [Open Source License] at: [https://open.source.license/]
#   *
#   * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
#   * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
#   * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#   *
#   * See the [Open Source License] for more details.
#   */
#   /**
#   * Author: Zheng Wang
#   * Created: Sep. 26, 2022
#   * Supported by: National Key Research and Development Program of China
#   */

import unittest
from phot_engine.engine_shell import graph_entity
from engine_test.test_data.fetch_data_util import util

SIMULATION_PROJECT_PATH = r"../test_data/GDUT_20240213_with_global_parameter.phtg"

vertex_data_list, edge_data_list, global_data_list = util.export_data_from_phtg(phtg_filepath=SIMULATION_PROJECT_PATH)


def add_data_to_graph_entity():
    try:
        ge = graph_entity.GraphEntity(scrutiny=True)
        for vertex_dict in vertex_data_list:
            ge.add_vertex(vertex_dict)
        for edge_dict in edge_data_list:
            ge.add_edge(edge_dict)
        ge.set_system_global_parameter(global_data_list=global_data_list)
    except Exception as e:
        return False
    return ge


class TestGraphEntity(unittest.TestCase):
    def test_graph_entity_interface(self):
        ge = add_data_to_graph_entity()
        self.assertIs(graph_entity.GraphEntity, type(ge))
        ge.print_graph_entity_meta_data(show_detail=True)




if __name__ == '__main__':
    unittest.main()
